<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="utf-8">
	<title>这是一个首页</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="resources/js/jquery-3.3.1.js" media="all" />
	<link rel="stylesheet" href="resources/css/public.css" media="all" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<!--<link rel="stylesheet" href="resources/css/font.css">
	<link rel="stylesheet" href="resources/css/xadmin.css">-->
	<link rel="stylesheet" href="resources/css/layuiadmin.css">
	<script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
	<!-- 引入 echarts.js -->
	<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
	<style>
		#affiche {
			color: red;
			display: block;
			width: 96%;
			height: 30px;
			margin: 0 auto;
			position: relative;
			overflow: hidden;
		}
		.affiche_text {
			position: absolute;
			top: 0;
			left: 100%;
			line-height: 30px;
			display: block;
			word-break: keep-all;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	</style>
	<style id="LAY_layadmin_theme">
		.layui-side-menu,.layadmin-pagetabs
		.layui-tab-title li:after,.layadmin-pagetabs
		.layui-tab-title li.layui-this:after,.layui-layer-admin
		.layui-layer-title,.layadmin-side-shrink
		.layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child{background-color:#20222A !important;}
		.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,
		.layui-nav-tree .layui-nav-child dd.layui-this,
		.layui-nav-tree .layui-nav-child dd.layui-this a{background-color:#009688 !important;}
		.layui-layout-admin .layui-logo{background-color:#20222A !important;}
	</style>
</head>

<body class="childrenBody">
	<blockquote class="layui-elem-quote layui-bg-green">
		<div id="nowTime"></div>
	</blockquote>

	<div id="affiche">
		<div class="affiche_text">
			<span id="show"></span>
		</div>
	</div>
	<div style="display: none">
		<span id="userName"  th:text="${session.USER_SESSION.realname}"></span>
	</div>

	<div class="layui-fluid">
		<div class="layui-row layui-col-space15">
			<div class="layui-col-md8">
				<div class="layui-row layui-col-space15">
					<div class="layui-col-md6">
						<div class="layui-card">
							<div class="layui-card-header">快捷菜单</div>
							<div class="layui-card-body">

								<div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 280px;">
									<div carousel-item="">
										<ul class="layui-row layui-col-space10 layui-this">
											<li class="layui-col-xs3">
												<a href="toSaleChance.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
												<i class="layui-icon layui-icon-console"></i>
													<cite>销售机会</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toDevPlan.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-console"></i>
													<cite>开发计划</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toCustomerManager.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-template-1"></i>
													<cite>查看客户</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toCustLostManager.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-chat"></i>
													<cite>流失管理</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toServiceAddPage.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-find-fill"></i>
													<cite>新建服务</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toServiceEditPage.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-survey"></i>
													<cite>服务分配</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toServiceDealPage.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-user"></i>
													<cite>服务处理</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a href="toCustomerContribute.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<i class="layui-icon layui-icon-set"></i>
													<cite>统计报表</cite>
												</a>
											</li>
										</ul>
										<ul class="layui-row layui-col-space10">
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
											<li class="layui-col-xs3">
												<a lay-href="set/user/info.html">
													<i class="layui-icon layui-icon-set"></i>
													<cite>我的资料</cite>
												</a>
											</li>
										</ul>

									</div>
									<div class="layui-carousel-ind"></div><button class="layui-icon layui-carousel-arrow" lay-type="sub"></button><button class="layui-icon layui-carousel-arrow" lay-type="add"></button></div>

							</div>
						</div>
					</div>
					<div class="layui-col-md6">
						<div class="layui-card">
							<div class="layui-card-header">待办事项</div>
							<div class="layui-card-body">

								<div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 280px;">
									<div carousel-item="">
										<ul class="layui-row layui-col-space10 layui-this">
											<li class="layui-col-xs6">
												<a href="toNoAssignSaleChance.do" class="layadmin-backlog-body">
													<h3>待分配销售机会</h3>
													<p><cite><span id="waitSaleChan" style="color: #0B61A4"></span></cite></p>
												</a>
											</li>
											<li class="layui-col-xs6">
												<a href="toNoSuccessDevPlan.do" class="layadmin-backlog-body">
													<h3>待开发成功</h3>
													<p><cite><span id="waitDevPlan" style="color: #0B61A4"></span></cite></p>
												</a>
											</li>
											<li class="layui-col-xs6">
												<a href="toServiceEditPage.do" class="layadmin-backlog-body">
													<h3>待分配服务</h3>
													<p><cite><span id="serviceEidt"></span></cite></p>
												</a>
											</li>
											<li class="layui-col-xs6">
												<a href="toCustWillLostManager.do" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
													<h3>流失客户预警</h3>
													<p><cite><span id="willLost" style="color:orangered">10</span></cite></p>
												</a>
											</li>
										</ul>
										<ul class="layui-row layui-col-space10">
											<li class="layui-col-xs6">
												<a href="javascript:;" class="layadmin-backlog-body">
													<h3>待审友情链接</h3>
													<p><cite style="color: #FF5722;">5</cite></p>
												</a>
											</li>
										</ul>
									</div>
									<div class="layui-carousel-ind"></div><button class="layui-icon layui-carousel-arrow" lay-type="sub"></button><button class="layui-icon layui-carousel-arrow" lay-type="add"></button></div>
							</div>









						</div>
					</div>







					<div class="layui-col-md12">
						<div class="layui-card">
							<div class="layui-card-header">数据概览</div>
							<div class="layui-card-body">

								<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview" lay-anim="fade" lay-indicator="inside" lay-arrow="none" style="width: 100%; ">
									<div id="main" style="width: 100%;height:330px;"></div>
									<div class="layui-carousel-ind"></div><button class="layui-icon layui-carousel-arrow" lay-type="sub"></button><button class="layui-icon layui-carousel-arrow" lay-type="add"></button></div>

							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="layui-col-md4">
				<div class="layui-card">
					<div class="layui-card-header">CRM系统信息</div>
					<div class="layui-card-body layui-text" style="height:184px;">
						<table class="layui-table">
							<colgroup>
								<col width="100">
								<col>
							</colgroup>
							<tbody>
							<tr>
								<td>当前版本</td>
								<td>
									<script type="text/html" template="">
										v{{ layui.admin.v }}
										<a href="http://fly.layui.com/docs/3/" target="_blank" style="padding-left: 10px;">日志</a>
									</script> l-admin1.0
								</td>
							</tr>
							<tr>
								<td>基于框架</td>
								<td>
									<script type="text/html" template="">
										layui-v{{ layui.v }}
									</script> layui</td>
							</tr>
							<tr>
								<td>行业对接</td>
								<td>零售 / 教育 / 培训 / 建筑等</td>
							</tr>
							<tr>
								<td>开发者</td>
								<td style="padding-bottom: 0;">蜗牛学院CRM</td>
							</tr>
							</tbody>
						</table>
					</div>
				</div>

				<div class="layui-card">
					<div class="layui-card-header">登录动态</div>
					<div class="layui-card-body">
						<dl class="layuiadmin-card-status">
							<table id="sysLogsList" lay-filter="sysLogsList"></table>
						</dl>
					</div>
				</div>



			</div>
		</div>
	</div>
</body>
</html>
<script src="../js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script src="https://cdn.bootcss.com/echarts/3.7.0/echarts.min.js"></script>
<!--<div id="main" style="width: 800px;height:450px;"></div>-->
<script type="text/javascript">
			$(document).ready(function(){
				// 基于准备好的dom，初始化echarts实例
				var myChart = echarts.init(document.getElementById('main'));
				//数据加载完之前先显示一段简单的loading动画
				myChart.showLoading();
				var names=[];    //横坐标数组（实际用来盛放X轴坐标值）
				var values=[];    //纵坐标数组（实际用来盛放Y坐标值）

				$.ajax({
					type : "post",
					async : true,            //异步请求（同步请求将会锁住浏览器，用户其他操作必须等待请求完成才可以执行）
					url : "/show",    //请求发送到dataActiont处
					data : {},
					dataType : "json",        //返回数据形式为json
					success : function(result) {
						//请求成功时执行该函数内容，result即为服务器返回的json对象
						if (result) {
							for(var i=0;i<result.length;i++){
								names.push(result[i].basiItem);
								values.push(result[i].countlevel);
							}
							myChart.hideLoading();    //隐藏加载动画
							myChart.setOption({
								//加载数据图表
								title:{
									text: '顾客等级统计图'
								},

								legend: {
									data:['用户等级']
								},
								xAxis: {
									data: names,
									axisLabel:{
										interval: 0
									}

								},
								yAxis: {
									type: 'value'
								},
								series: [{
									// 根据名字对应到相应的系列
									name: '用户等级',
									type: 'bar',
									itemStyle: {
										normal: {
											color: function(params) {
												// build a color map as your need.
												var colorList = [
													'#27727B',
												];
												return colorList[params.dataIndex]
											},
											label: {
												show: true,
												position: 'top',
//                             formatter: '{c}'
												formatter: '{b}\n{c}'
											}
										}
									},
									data: values
								}]
							});
						}
					},
					error : function(errorMsg) {
						//请求失败时执行该函数
						alert("图表请求数据失败!");
						myChart.hideLoading();
					}
				});//end ajax
			});
			//获取流失预警的数据总数
            $.ajax({
                url:'custWillLost',
                success:function (data) {
                    var cc=data.length
                    $("#willLost").html(cc)
                }
            });
            $.ajax({
				url: "servicecCont",
				success:function (data) {
                    $("#serviceEidt").html(data);
            }
			});
            //未指派
			$.ajax({
				url:'selectNoAssignSale',
				success:function (res) {
					var len=res.length
					$("#waitSaleChan").html(len)
                }
			});
			//待开发，就是没有开发成功的
            $.ajax({
                url:'selectNoSuccessDevPlan',
                success:function (res) {
                    console.log(res.data)
					var s=res.data
                    var len=s.length
					console.log(len)
                    $("#waitDevPlan").html(len)
                }
            });


            //滚动条
            (function(){var timer = setTimeout(this.marquee, 1000);}());
            function marquee() {
                var scrollWidth = $('#affiche').width();
                var textWidth = $('.affiche_text').width();
                var i = scrollWidth;
                setInterval(function() {
                    i--;
                    if(i < -textWidth ) {
                        i = scrollWidth;
                    }
                    $('.affiche_text').animate({'left': i+'px'}, 20);
                }, 20);
            }
            //获取系统时间
            var newDate = '';
            getLangDate();
            //值小于10时，在前面补0
            function dateFilter(date){
                if(date < 10){return "0"+date;}
                return date;
            }
            function getLangDate(){
                var dateObj = new Date(); //表示当前系统时间的Date对象
                var year = dateObj.getFullYear(); //当前系统时间的完整年份值
                var month = dateObj.getMonth()+1; //当前系统时间的月份值
                var date = dateObj.getDate(); //当前系统时间的月份中的日
                var day = dateObj.getDay(); //当前系统时间中的星期值
                var weeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
                var week = weeks[day]; //根据星期值，从数组中获取对应的星期字符串
                var hour = dateObj.getHours(); //当前系统时间的小时值
                var minute = dateObj.getMinutes(); //当前系统时间的分钟值
                var second = dateObj.getSeconds(); //当前系统时间的秒钟值
                var username= document.getElementById("userName").innerText
                var timeValue = "" +((hour >= 12) ? (hour >= 18) ? "晚上" : "下午" : "上午" ); //当前时间属于上午、晚上还是下午
                newDate = dateFilter(year)+"年"+dateFilter(month)+"月"+dateFilter(date)+"日 "+" "+dateFilter(hour)+":"+dateFilter(minute)+":"+dateFilter(second);
                document.getElementById("nowTime").innerHTML = "亲爱的"+username+"，"+timeValue+"好！ 欢迎使用CRM1.0系统。当前时间为： "+newDate+"　"+week;
                setTimeout("getLangDate()",1000);
                document.getElementById("show").innerHTML = "亲爱的"+username+"，"+timeValue+"好！ 欢迎使用CRM1.0系统。当前时间为： "+newDate+"　"+week;

            }
		</script>

<script type="text/javascript" th:inline="none">
	layui.use(['form','layer','table','laytpl'],function(){
		var form = layui.form,
				layer = parent.layer === undefined ? layui.layer : top.layer,
				$ = layui.jquery,
				laytpl = layui.laytpl,
				table = layui.table;
		//用户列表
		var tableIns = table.render({
			elem: '#sysLogsList',
			url : 'loginsysLogs.do',
			cellMinWidth : 95,
			page : true,
			height : "full-125",
			limits : [10,15,20,25],
			limit : 20,
			id : "sysLogsListTable",
			cols : [[
				//{type: "checkbox", fixed:"left", width:50},
				//{field: 'id', title: '编号', minWidth:100, align:"center"},
				//{field: 'httpMethod', title: '请求方法', align:'center'},
				{field: 'username', title: '用户名', align:'center'},
				{field: 'starttime', title: '时间', align:'center'},
				{field: 'ip', title: 'IP地址', align:'center'},
				//{field: 'args', title: 'post', align:'center'},
				//{field: 'classMethod', title: '方法名', align:'center'},
				//{field: 'url', title: 'url', align:'center'},
			]]
		});

	});
</script>



